package com.doubi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.doubi.entity.Releasetable;
import com.doubi.entity.ResponseEntity;
import com.doubi.mapper.ReleasetableMapper;
import com.doubi.service.ReleasetableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReleasetableServiceImpl extends ServiceImpl<ReleasetableMapper, Releasetable> implements ReleasetableService {
    @Autowired
    private ReleasetableMapper releasetableMapper;

    @Override
    public Integer addviewCounts(int i,Integer rid) {
      return   releasetableMapper.addviewCounts(i,rid);
    }

    @Override

    public Integer getCount(Integer userId, Integer classId) {
        return releasetableMapper.getCount(userId, classId);
    }
    public List<Releasetable> getReleasetableList(List<Integer> uid) {
        return releasetableMapper.getReleasetableList(uid);
    }

    @Override
    public List<Releasetable> getIndexList(Integer userId) {
        return releasetableMapper.getIndexList(userId);
    }

    @Override
    public ResponseEntity videoConditionQuery(Integer pageNo, Integer pageSize, String title, Integer classId, String userName) {
        ResponseEntity responseEntity = new ResponseEntity();
        List<Releasetable> releasetableList = releasetableMapper.vedioConditionQuery(pageNo, pageSize, title, classId, userName);
        List<Releasetable> releasetableList2 = releasetableMapper.vedioConditionQuery(0, 1000, title, classId, userName);
        responseEntity.setCount(releasetableList2.size());
        responseEntity.addDate("videoList",releasetableList);
        return responseEntity;
    }

    @Override
    public int delVideoByIds(List<Integer> videoIds) {
        return releasetableMapper.delVideoByIds(videoIds);
    }
}
